package fzdy.tools;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by Administrator on 2017/4/20 0020.
 */
public class RegularTools {
    public static Boolean IsTelephone(String mobiles) {
        Boolean f;
        Pattern p = Pattern.compile("^0?(13[0-9]|15[012356789]|17[013678]|18[0-9]|14[57])[0-9]{8}$");
        Matcher m = p.matcher(mobiles);
        f = m.matches();
        if (f) {
            return f;
        }
        p = Pattern.compile("^(0[0-9]{2,3}/-)?([2-9][0-9]{6,7})+(/-[0-9]{1,4})?$");
        m = p.matcher(mobiles);
        f = m.matches();
        return f;
    }

    public static Boolean IsNumAndAlphabet(String mobiles) {
        Pattern p = Pattern.compile("^[a-zA-Z\\d]+$");
        Matcher m = p.matcher(mobiles);
        return m.matches();
    }
}
